package com.yitao.fdfs.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.data.redis.config.ConfigureRedisAction;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.web.http.CookieHttpSessionIdResolver;

@Configuration
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 60 * 1440)
public class HttpSessionConfig {

    @Bean
    public static ConfigureRedisAction configureRedisAction() {
        return ConfigureRedisAction.NO_OP;
    }

    @Bean
    public CookieHttpSessionIdResolver cookieHttpSessionStrategy() {
        CookieHttpSessionIdResolver strategy = new CookieHttpSessionIdResolver();
        strategy.setCookieSerializer(new CustomerCookieSerializer());
        return strategy;
    }
}
